sorting in itunes

Is it possible to export the sorting info for movies in itunes and re-import them into another playlist ?


a.k.a in one playlist i have say


"The Lord of the Rings"

sort as "Lord of the Rings"


Can i export this info in CSV or something ? That way i can create new playlist,,, import all my movies and run a script or automatically reapply the sorting to all movies at once.


If not possible between .it files alone, then could be done inside itunes ?


e.g i was thinking user is asked to open first .it file... Apple script grabs all "Sort as" info, stored them as variables, closes the file. User is asked to open second .it file and Apple script import sort info back.

MacBook Pro with Retina display, OS X Yosemite (10.10.5), null

Posted on Aug 14, 2016 4:23 PM

Reply
2 replies

Aug 15, 2016 1:55 PM in response to Tech198

It's pretty trivial to export a list of movie names with their sort name:


use AppleScriptversion "2.4" -- Yosemite (10.10) or later

use scripting additions


tell application "iTunes"

set f to open for accessfile ((path todesktopastext) & "tracks.txt") with write permission


set eoffto 0

set myMovies to (get every track whose media kind is movie)

repeat with aTrack in myMovies

tell aTrack

write its name & "," & its sort name & return to f

end tell

end repeat


close accessf

end tell

However, I'm unsure as to the goal you're asking for - are you suggesting that the same track in two playlists may have different sorting values? I've never noticed that if that's the case (I've always assumed the sort name is associated with the track and not with the specific track/playlist combination).


In either case, resetting the sort values is a matter of reversing the process - read the file, find the track based on the first field, set the sort value to the second field. However I would caution against using CSV since movie names could, conceivable, contain a comma, which could interfere with reading the data back in. Use some other delimiter.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

sorting in itunes

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.